package cc.fine.svc.main.enums;

import cc.fine.svc.common.exception.FineException;
import cc.fine.svc.common.utils.R;

public enum UserLevelType {

    NORMAL(0, "normal"),
    ADMIN(1, "admin");

    private final Integer code;
    private final String msg;

    UserLevelType(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String codeOf(Integer code) {
        for (UserLevelType e : values()) {
            if (code.equals(e.code)) {
                return e.msg;
            }
        }

        throw new FineException(R.ERROR, "user level 状态码异常");
    }
}
